home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / mint / lib / mntlib44.zoo / mntlib / lib.h < prev    next >
C/C++ Source or Header  |  1994-03-01  |  4KB  |  134 lines

  1. /*
  2.  * library-specific stuff
  3.  */
  4. #ifndef _LIB_H
  5. #define _LIB_H
  6.  
  7. #ifndef _COMPILER_H
  8. #include <compiler.h>
  9. #endif
  10.  
  11. #include <stdio.h>    /* for FILE   */
  12. #include <time.h>    /* for time_t */
  13.  
  14. /* filename mapping function type */
  15. #ifndef __FNMAP
  16. #define __FNMAP
  17. typedef int (*fnmapfunc_t) __PROTO((const char *, char *));
  18. #endif
  19.  
  20. __EXTERN int        _unx2dos __PROTO((const char *, char *));
  21. __EXTERN int        _dos2unx __PROTO((const char *, char *));
  22. #ifndef __MINT__
  23. __EXTERN int        unx2dos __PROTO((const char *, char *));
  24. __EXTERN int        dos2unx __PROTO((const char *, char *));
  25. __EXTERN void        fnmapfunc __PROTO((fnmapfunc_t u2dos, fnmapfunc_t dos2u));
  26. #endif
  27. __EXTERN int        _path_dos2unx __PROTO((const char *, char *));
  28. __EXTERN int        _path_unx2dos __PROTO((const char *, char *));
  29.  
  30. __EXTERN long        _write      __PROTO((int, const void *, unsigned long));
  31. __EXTERN long        _read      __PROTO((int, void *, unsigned long));
  32. #ifndef __MINT__
  33. __EXTERN int        console_input_status __PROTO((int));
  34. __EXTERN unsigned int    console_read_byte __PROTO((int));
  35. __EXTERN void        console_write_byte __PROTO((int, int));
  36. #else
  37. __EXTERN int    _console_read_byte __PROTO((int));
  38. __EXTERN void    _console_write_byte __PROTO((int, int));
  39. #endif
  40.  
  41. __EXTERN time_t        _dostime __PROTO((time_t));
  42. __EXTERN time_t        _unixtime __PROTO((unsigned int, unsigned int));
  43.  
  44. __EXTERN char *        _itoa __PROTO((int, char *, int));
  45. __EXTERN char *        _ltoa __PROTO((long, char *, int));
  46. __EXTERN char *        _ultoa __PROTO((unsigned long, char *, int));
  47.  
  48. __EXTERN int        _doprnt __PROTO((int (*)(int, FILE *), FILE *, const char *, __VA_LIST__));
  49.  
  50. #ifdef __MINT__
  51. __EXTERN int    _scanf __PROTO((FILE *, int (*)(FILE *),
  52.             int (*)(int, FILE *), const char *, __VA_LIST__));
  53. __EXTERN int    _enoent __PROTO((char *));
  54. #endif
  55.  
  56. __EXTERN long        get_sysvar __PROTO((void *var));
  57. __EXTERN void        set_sysvar_to_long __PROTO((void *var, long val));
  58.  
  59. __EXTERN void    _main        __PROTO((long, char **, char **));
  60. __EXTERN void    _init_signal    __PROTO((void));
  61. __EXTERN void     _monstartup    __PROTO((void *lowpc, void *highpc));
  62. __EXTERN void    __mcleanup    __PROTO((void));
  63. __EXTERN void    _moncontrol    __PROTO((long));
  64. __EXTERN void    _setstack    __PROTO((char *));
  65. __EXTERN void    _crtinit    __PROTO((void));
  66. __EXTERN void    _acc_main    __PROTO((void));
  67. __EXTERN __EXITING    __exit    __PROTO((long status)) __NORETURN;
  68.  
  69. __EXTERN void    _fclose_all_files __PROTO((void));
  70. /* from the TOS GCC library */
  71. /* 5/5/92 sb -- definitions needed in malloc.c and realloc.c */
  72.  
  73. struct mem_chunk 
  74.     {
  75.     long valid;
  76. #define VAL_FREE  0xf4ee0abcL
  77. #define VAL_ALLOC 0xa11c0abcL
  78.  
  79.     struct mem_chunk *next;
  80.     unsigned long size;
  81.     };
  82.  
  83. /* linked list of free blocks */
  84.  
  85. extern struct mem_chunk _mchunk_free_list;
  86.  
  87. /* status of open files (for isatty, et al.) */
  88.  
  89. #ifdef __MINT__
  90.  
  91. #define __NHANDLES 40
  92.  
  93. struct __open_file {
  94.     short    status;        /* whether or not it's a tty */
  95.     short    flags;        /* if a tty, its flags */
  96. };
  97.  
  98. #else
  99.  
  100. #define __NHANDLES    80
  101. struct __open_file {
  102.     unsigned short append:1;    /* 1 if O_APPEND set for this file */
  103.     unsigned short nodelay:1;    /* 1 if O_NDELAY set for this file */
  104.     unsigned short pipe:1;      /* 1 if O_PIPE set for this file */
  105.     unsigned short eclose:1;    /* 1 if close on exec is set for this file */
  106.     unsigned short status:2;    /* status FH_UNKNOWN | ISATTY | ISAFILE */
  107.     char       *filename;    /* filename of open file */
  108. };
  109.  
  110. #endif /* __MINT__ */
  111.  
  112. extern struct __open_file __open_stat[];
  113.   /* NOTE: this array is indexed by (__OPEN_INDEX(fd)) */
  114.  
  115. #define __OPEN_INDEX(x)    (((short)(x)) + 3)
  116.  
  117. #define FH_UNKNOWN    0
  118. #define FH_ISATTY    1
  119. #define FH_ISAFILE    2
  120.  
  121. /*
  122.  * macro for converting a long in DOS format to one in Unix format. "x"
  123.  * _must_ be an lvalue!
  124.  */
  125. #define __UNIXTIME(x) (x = _unixtime( ((short *)&x)[0], ((short *)&x)[1] ))
  126.  
  127. __EXTERN int _do_lock __PROTO((int fd, int cmd, long size, int whence));
  128.  
  129. #ifdef _STDIO_H
  130. __EXTERN FILE *_fopen_i __PROTO((const char *, const char *, FILE *));
  131. #endif
  132.  
  133. #endif /* _LIB_H */
  134.